package com.dwms.feign.system;

import com.dwms.entity.PageResponse;
import com.dwms.entity.QueryRequest;
import com.dwms.entity.Request;
import com.dwms.entity.Result;
import com.dwms.entity.system.menu.request.MenuQueryRequest;
import com.dwms.entity.system.menu.request.MenuRequest;
import com.dwms.entity.system.menu.response.MenuResponse;
import com.dwms.entity.system.menu.response.RouterResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @ClassName UserApi
 * @Description: 用户API
 * @Create 2022/10/19 19:37
 * @Author WH
 * @Since 1.0.0
 */
@FeignClient(value = "system-server",path = "/menu")
public interface MenuFeignClient {

    /**
     * 新增菜单
     * @param menuRequest
     * @return
     */
    @PostMapping("/save")
    Result save(@RequestBody MenuRequest menuRequest);

    /**
     * 更新菜单
     * @param menuRequest
     * @return
     */
    @PostMapping("/update")
    Result update(@RequestBody MenuRequest menuRequest);

    /**
     * 分页查询菜单
     * @param query
     * @return
     */
    @PostMapping("/findPage")
    Result<PageResponse<MenuResponse>> findPage(@RequestBody MenuQueryRequest query);

    /**
     * 根据ID查询菜单
     * @param query
     * @return
     */
    @PostMapping("/findById")
    Result<MenuResponse> findById(@RequestBody QueryRequest query);

    /**
     * 删除菜单
     * @param query
     * @return
     */
    @PostMapping("/delete")
    Result delete(@RequestBody QueryRequest query);

    /**
     * 获取路由信息
     * @return  RouterResponse
     */
    @PostMapping("/findRouters")
    Result<List<RouterResponse>> findRouters(@RequestBody Request request);
}
